<?php
/**
 * PushController.php
 *
 * @copyright   2023 thingsworld.com.cn - All Rights Reserved
 * @link        http://thingsworld.com.cn/
 * @author      stiffer.chen <chenl@thingsworld.com.cn>
 * @created     2023-02-27 17:42:51
 * @modified    2023-02-27 17:42:51
 *
 */

namespace App\Http\Controllers;

use App\Services\Push\GeTuiService;

class PushController extends BaseController
{
    /**
     * @OA\Get(
     *     path="/push",
     *     tags={"Push"},
     *     summary="推送测试",
     *     description="推送测试",
     *     operationId="push_index",
     *     @OA\Parameter(name="notify_id", in="query", description="通知ID", required=false, @OA\Schema(default="", type="string")),
     *     @OA\Parameter(name="user_ids", in="query", description="用户ID", required=false, @OA\Schema(default="", type="string")),
     *     @OA\Response(response=200, description="请求成功"),
     *     @OA\Response(response=401,description="鉴权失败"),
     *     @OA\Response(response=422, description="请求异常")
     * )
     */
    public function index()
    {
        $userIds = request()->get('user_ids') ?? '';
        $notifyId = request()->get('notify_id') ?? '';
        if (empty($notifyId)) {
            return message('通知ID错误', false);
        }
        $pushServ = new GeTuiService($userIds, $notifyId);
        $pushServ->push();
    }
}